package xing.design.pattern.behavioral.strategy;

import xing.design.pattern.behavioral.strategy.behavior.Cycle;
import xing.design.pattern.behavioral.strategy.behavior.Walk;

/**
 * @author xing
 * @date 2023/2/8 0:41:11
 */
public class Main {
    public static void main(String[] args) {
        Walk walk = new Walk();
        GoHomePerson person = new GoHomePerson(walk);
        person.goHome();

        person.setGoHomeMethod(new Cycle());
        person.goHome();

        person.setGoHomeMethod(() -> {
            System.out.println("跑步回家.");
        });
        person.goHome();
    }
}
